package com.zsxj.xixi.common.utils;

/**
 * @Description 异常工具类
 * @Author liuyuqing
 * @Date 2021/3/31 16:47
 **/
public class ExceptionUtils {
    private static final int ALARM_CONTENT_MAX_LENGTH = 1500;

    public static String getAlarmStackTrace(Throwable throwable) {
        String eInfo = org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace(throwable);
        if (eInfo == null) {
            eInfo = "";
        }
        if (eInfo.length() > ALARM_CONTENT_MAX_LENGTH) {
            eInfo = eInfo.substring(0, ALARM_CONTENT_MAX_LENGTH);
        }
        return eInfo;
    }
}
